from likeshop_project.base.mybase import Tools
from likeshop_project.accountapi.login_api import login_model

class  add_shopping_model(Tools):
    path = '/api/cart/add'
    def add_shopping_action(self,hb,item_id,goods_num):
        mydata = {
            'item_id':item_id,
            'goods_num':goods_num

        }
        res = self.huihua.post(url=self.hosturl+self.path,data=mydata,headers=hb)
        return res.json()


if __name__ == '__main__':

    import requests
    s = requests.session()
    re = login_model(huihua=s)
    mag = re.login_action(account='17909898989',password='123wqewqrf')
    gettoken = mag['data'].get('token')
    hb = {'token':gettoken}
    re = add_shopping_model(huihua=s)
    msg =re.add_shopping_action(item_id='2',goods_num='32',hb=hb)
    print(msg)